﻿using System;
using NguyenHoa.Domains;
using NguyenHoa.Services;
using NguyenHoa.Web.App_Code;

namespace NguyenHoa.Web.Pages
{
  public partial class AboutUs : BasePage
  {
    #region Events
    protected void Page_Load(object sender, EventArgs e)
    {
      if (!IsPostBack && !IsCallback)
      {
        LoadContent();
        LoadPhoto();
      }
    }
    #endregion

    #region Methods
    private void LoadContent()
    {
      TList<HtmlContent> contentList = new HtmlContentService().GetByTypeAndLanguage(TypeId, CurrentLanguage.Id);
      if (contentList.Count > 0)
      {
        ltrContent.Text = contentList[0].Content;
      }
    }

    private void LoadPhoto()
    {
      if (TypeId.HasValue && TypeId.Value == 1)
      {
        rptIntroPhoto.DataSource = new MultimediaService().GetPhotoByType(MultimediaType.Intro);
        rptIntroPhoto.DataBind();
      }
    }
    #endregion
  }
}
